package com.ea.eadp.nexus.test.workflow.newconsole.login;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import com.ea.eadp.nexus.test.pageDefinition.newconsole.UnderageOriginAccountPage;
import com.ea.eadp.nexus.test.workflow.WorkflowElement;
import com.ea.eadp.nexus.test.workflow.WorkflowElementArgument;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

public class UnderageLoginWorkflowElement  extends WorkflowElement {
    
    protected UnderageOriginAccountPage page;
    
    public UnderageLoginWorkflowElement(
        WebDriver driver, WorkflowElementArgument argument
    ) {
        super(driver, argument);
        page = new UnderageOriginAccountPage(driver);
    }
    
    @Override
    public void init() {
        page.validatePageLoadCompleted(UnderageOriginAccountPage.originIdInputBox);
    }
    
    @Override
    public void doAction() {
        page.sendControllerKey('A');
        log.info("Enter Origin Id:" + args.originId);
        page.sendInput(UnderageOriginAccountPage.originIdInputBox, args.originId);
        page.clickBlank("//div[@id='panel-underage-login']//div[@class='titleBar']");
        
        log.info("Enter Password:" + args.password);
        page.sendInput(UnderageOriginAccountPage.passwordInputBox, args.password);
        page.clickBlank("//div[@id='panel-underage-login']//div[@class='titleBar']");
    }
    @Override
    public void doVerification(){
       page.doVerification();
    }

    @Override
    public void moveNext() {
        page.sendControllerKey('A');
    }
    
}
